Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A draft based on a draft? Pure madness.
This revamps the interface of
interpretNew
to the point it can cover almost all previous uses ofinterpretH
. The only exception are the badlower-
interpreters, and if we really want, we can expand the interface to cover them too.Despite its power, the interface is actually fairly simple: we manage to avoid exposing that
MonadTransWeave
is at play under the hood.interpretNew
has the type signaturewhere
Which is only moderately scary. The interface associated with
RunH
are the functions:runExposeH
andrestoreH
is for all the effectful state manipulation some interpreters need to do in order to work correctly, such asrunWriter
.Now the question is: is even this too complex? We can take measures to reduce the complexity: such as having
Polysemy
only exportrunH
andrunH'
, and having the other methods be part of a different module, sayPolysemy.InterpretH
or something, but the type ofEffHandlerH
is still somewhat scary -- on the same level asTactical
.Unfortunately, I haven't found a way to simplify
EffHandlerH
further -- even if you try to only supportrunH
andrunH'
, I still can't figure out a way to get rid of the 2 extra type variables associated withRunH
(although you can remove theTraversable
constraint.)